% Set parameter values

timeunit=1;         % one year = 1
month_time=1/12;    % one month = 1/12

% calibrated parameters
eta=3;
mu=0.2115;
zeta=1;    % zeta is indepenedent of a -> varsigma=0.5
rho=0.02;
rm=rho+mu;      % shorthand for rho+mu
a=[0.9 1.1];    % a_L and a_H

n=40000;        % # of firms. Asign an even integer
Z=ceil(n*mu*1000); % # of total calvo shocks in the simulation
delta=0.0021;       % \delta^+  menu cost for price increase
delta_u=1/n^2.2;    % \delta^-  menu cost for price decrease

% utility function (C^alpha_U (1-N)^(1-alpha_U))^(1-gamma_U)/(1-gamma_U) +
% log(m)
alpha_U=0.4213;      % yields N=1/3 of total time for pi=0.03
gamma_U=3;           

vp=@(x,px) (x^px-1)/px; % function varphi(q,x)
tol_w=1e-13;    % tolerance for steady state wage

% q_a solves 0=find_q. This equation is obtained from (S.25)&(S.26)
findq =@(x,rm,delta,eta,pp,a,w) ...
    (eta-1)/eta *vp(x,rm/pp+1-eta)/vp(x,rm/pp-eta) *a ...
    * ((vp(x,rm/pp+1-eta)/vp(x,rm/pp-eta)*vp(x,-eta) ...
    -vp(x,1-eta))*(eta-1)/rm/delta)^(1/(eta-1))-w;  